﻿//添加信息
var fnCustomAdd = function () {
    var pagetitle = "新增离职员工信息";
    const_EditEntity = "hrEmployee";
    parent._employeeTitle = pagetitle;
    parent.addTabs(pagetitle, "../Extend/Edit.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&type=3");
    parent.NeedRefreshPage = this;
}
//修改信息
var fnCustomEdit = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    const_EditEntity = "hrEmployee";
    var deptName = record.getData("DeptName");
    var postName = record.getData("PostName");
    var pagetitle = "修改离职员工信息—" + record.getData("CName");
    parent._employeeTitle = pagetitle;
    parent.addTabs(pagetitle, "../Extend/Edit.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID) + "&deptName=" + deptName + "&postName=" + postName + "&type=3");
    parent.NeedRefreshPage = this;
}

//返聘
var fnChongXinRuZhi = function () {
//    var recordID = myDataTable.getSelectedRows()[0];
//    record = myDataTable.getRecord(recordID);
//    if (record == null) {
//        alert("请选择一条记录");
//        return;
//    }
//    document.getElementById("dialog1_h").innerHTML = "人事事务—返聘";
//    const_EditEntity = 'hrEmployeeAffairs';
//    var id = record.getData(const_entityID);
//    var empCode = record.getData("EmployeeCode");
//    var empName = record.getData("CName");
//    document.getElementById("EditUIWindow").src = encodeURI("../Extend/AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&affairsType=6&empId=" + id + "&empCode=" + empCode + "&empName=" + empName);
//    SetDWH(550, 320, YAHOO.example.container.dialog1);
    //    YAHOO.example.container.dialog1.show();
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    document.getElementById("dialog1_h").innerHTML = "人事事务—返聘";
    var id = record.getData(const_entityID);
    var deptId = _key;
    var deptName = _Caption;
    var postName = record.getData("PostName");
    var empCode = record.getData("EmployeeCode");
    var empName = record.getData("CName");
    var postRank = record.getData("PostLevel");
    const_EditEntity = 'hrEmployeePositions';
    document.getElementById("EditUIWindow").src = "../Extend/AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&empId=" + id + "&postName=" + postName + "&deptName=" + deptName + "&empCode=" + empCode + "&empName=" + empName + "&postRank=" + postRank+"&postType=2";
    SetDWH(580, 300, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}

//查看员工详细信息
var fnChaKanXinXi = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    var id = record.getData(const_entityID);
    var pagetitle = "查看员工信息—" + record._oData["CName"];
    parent.addTabs(pagetitle, "../EHR/hrViewEmployeeInfo.aspx?id=" + id);
    parent.NeedRefreshPage = this;
}